package com.concurrent.execute;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AsExecuteResult<V> extends FutureTask<V> {

	private static Logger log = LoggerFactory.getLogger(AsExecuteResult.class);

	public AsExecuteResult(Runnable runnable, V result) {
		super(runnable, result);
	}

	public AsExecuteResult(Callable<V> callable) {
		super(callable);
	}

	public V get() {
		try {
			return super.get();
		} catch (Exception e) {
			log.error("", e);
		}
		return null;
	}

	public V get(long timeout, TimeUnit unit) {
		try {
			return super.get( timeout,  unit);
		} catch (Exception e) {
			log.error("", e);
		}
		return null;
	}

}
